﻿@using KPIS.GERP.Models.ICM
@model BidderCollateral

@if (ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit")
{
@Html.HiddenFor(model => model.BidderColId)
@Html.HiddenFor(model => model.ColStatusId)
}
@Html.HiddenFor(model => model.BidderId)
@Html.HiddenFor(model => model.CreatedBy)
@Html.HiddenFor(model => model.CreatedWhen)
@Html.HiddenFor(model => model.UpdatedBy)
@Html.HiddenFor(model => model.UpdatedWhen)

@{
    
    var CollTypelst = new KPIS.GERP.WEB.GIMS.IcmMasLookUpService.IcmMasLookUpServiceClient().MasLookUpSelectList(KPIS.GERP.Models.ICM.IcmMasLookUpType.LookUpType.CollateralType);
    var CollStatuslst = new KPIS.GERP.WEB.GIMS.IcmMasLookUpService.IcmMasLookUpServiceClient().MasLookUpSelectList(KPIS.GERP.Models.ICM.IcmMasLookUpType.LookUpType.CollateralReturn);
    var CollCatelst = new KPIS.GERP.WEB.GIMS.IcmMasLookUpService.IcmMasLookUpServiceClient().MasLookUpSelectList(KPIS.GERP.Models.ICM.IcmMasLookUpType.LookUpType.CollateralCategory);
    bool bEdit = ViewContext.RouteData.Values["action"].ToString().ToLower() == "edit";

     
}

<div class="widget-box">
	<div class="widget-header header-color-blue2">
        <h4 class="lighter smaller">ข้อมูลหลักประกัน</h4>
    </div>
	<div class="widget-body">
		<div class="widget-body-inner">
			<div class="widget-main">
                <div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.Code)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.Code, new {placeholder = "ใส่ข้อมูลเลขที่อ้างอิง"})
                        @Html.Raw("&nbsp<font color=red>*</font>")
						@Html.ValidationMessageFor(model => model.Code)
					</div>            
				</div>
                <div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.ColCategoryId)
					</div>
					<div class="controls">   
						@Html.DropDownListFor(model => model.ColCategoryId, (bEdit ? new SelectList(CollCatelst, "value", "text", Model.ColCategoryId) : (IEnumerable<SelectListItem>)CollCatelst), "เลือกชนิดหลักประกัน"
                            , new { @class="chzn-select" })
                        @Html.Raw("&nbsp<font color=red>*</font>")
						@Html.ValidationMessageFor(model => model.ColCategoryId)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						  @Html.DisplayNameFor(model => model.ColTypeId)
					</div>
					<div class="controls">   
						@Html.DropDownListFor(model => model.ColTypeId, (bEdit ? new SelectList(CollTypelst, "value", "text", Model.ColTypeId) : (IEnumerable<SelectListItem>)CollTypelst), "เลือกประเภทของหลักประกัน"
                            , new { @class="chzn-select" })
                        @Html.Raw("&nbsp<font color=red>*</font>")
						@Html.ValidationMessageFor(model => model.ColTypeId)
					</div>            
				</div>				
                <div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.ReceiptNo)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.ReceiptNo, new {placeholder = "ใส่ข้อมูลเลขที่ใบเสร็จ"})
                        @*@Html.Raw("&nbsp<font color=red>*</font>")*@
						@Html.ValidationMessageFor(model => model.ReceiptNo)
					</div>            
				</div>
				<div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.Amount)
					</div>
					<div class="controls">
						@Html.EditorFor(model => model.Amount, new {placeholder = "ใส่ข้อมูลจำนวนเงิน"})
                        @Html.Raw("&nbspบาท&nbsp<font color=red>*</font>")
						@Html.ValidationMessageFor(model => model.Amount)
					</div>            
				</div>
                 <div class="control-group">
					<div class="control-label">
                        @Html.DisplayNameFor(model => model.Descr)
					</div>
					<div class="controls">
						@Html.TextAreaFor(model => model.Descr, new { style="height: 80px" })
						@Html.ValidationMessageFor(model => model.Descr)
					</div>
				</div>
                        
                <div class="control-group">
					<div class="control-label">
						@Html.DisplayNameFor(model => model.ColStatusId)
					</div>
					<div class="controls"> 
                        @if (bEdit) { 
                             @*@Html.DropDownListFor(model => model.ColStatusId, new SelectList(CollStatuslst,"value", "text", Model.ColStatusId)
                            , new { @class="chzn-select" , @disabled="disabled"})*@
                            @Html.DisplayFor(model => model.ColStatusId)
                        }
                        else{
                        @*@Html.DropDownListFor(model => model.ColStatusId, (bEdit ? new SelectList(CollStatuslst,"value", "text", Model.ColStatusId) : (IEnumerable<SelectListItem>)CollStatuslst.Take(1)), "เลือกสถานะการคืนหลักประกัน"
                            , new { @class="chzn-select" })*@
                            @Html.DropDownListFor(model => model.ColStatusId, (bEdit ? new SelectList(CollStatuslst,"value", "text", Model.ColStatusId) : (IEnumerable<SelectListItem>)CollStatuslst.Take(1)), "เลือกสถานะการคืนหลักประกัน"
                            , new { @class="chzn-select" })
                        }
                        @Html.Raw("&nbsp<font color=red>*</font>")
						@Html.ValidationMessageFor(model => model.ColStatusId)
					</div>            
				</div>
                    
                <div class="control-group">
					<div class="control-label">
                        @Html.DisplayNameFor(model => model.ReturnDate)
					</div>
					<div class="controls" id="content">
                        @Html.EditorFor(model => model.ReturnDate, new { placeholder = "เลือกวันที่คืนหลักประกัน"})
					</div>
				</div>

                <div class="control-group">
                    <div class="control-label">
                        วันที่ครบกำหนดคืนหลักประกัน
                    </div>
                    <div class="controls" id="content">
                        @Html.EditorFor(model => model.ReturnDueDate, new { placeholder = "เลือกวันที่ครบกำหนดคืนหลักประกัน" })
                    </div>
                </div>
			</div>
		</div>
	</div> 
</div>
